fix: #96 skip count and facet queries on Load more #116
+345
−79
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #96
What was done
searchAlbumsnow runs only the cursor page query.totalCount,genreFacets,decadeFacets,countryFacetsandreviewedCountareAlbumConnectionfield resolvers inserver/src/resolvers.ts, so they run only when an operation selects them.schema.graphqlis unchanged.SearchAlbumsPagequery (client/src/api/searchAlbums.ts) with onlyedgesandpageInfo. ThesearchAlbumsmerge inclient/src/api/client.tskeeps the first page's count and facets ({ ...existing, ...incoming, edges }). Codegen output regenerated.docs/scalability.mdand the README scalability section, plus a row indocs/AI-USAGE.md.What was tested
server/src/search/aggregates.test.tsruns both operations through Yoga against a database stand-in that records SQL: the first page runs 6 queries (page + 5 aggregates), Load more runs 1.client/src/api/client.test.ts: the page query validates against the schema, selects onlyedgesandpageInfo, and selects the same album fields asSearchAlbums; after a Load more page without aggregates, the cache still has page one's count and all facets.pagination.test.tsxmocks now serve Load more withSearchAlbumsPage. MockLink matches on the query document, so a Load more sent with the full query would fail these tests. The existing "Showing N of 40" checks after Load more still pass.facets.postgres.test.tsnow calls theAlbumConnectionresolvers.pnpm format:check,pnpm lint(0 warnings), typecheck in both workspaces, client build: pass.